package com.mobilepay.moneypig.model.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.mobilepay.moneypig.R;
import com.mobilepay.moneypig.base.BaseDialog;

public class PayTypeDialog extends BaseDialog implements View.OnClickListener {
    public PayTypeDialog(Context context) {
        super(context);
    }

    public PayTypeDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected PayTypeDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    private RelativeLayout mTextAlipay;
    private RelativeLayout mTextWeixin;
    private TextView mTextCancle;

    @Override
    protected void onSetContentView() {
        setContentView(R.layout.dialog_paytype);
    }

    @Override
    protected void initViews() {
        mTextAlipay = (RelativeLayout) findViewById(R.id.type_alipay);
        mTextWeixin = (RelativeLayout) findViewById(R.id.type_weixin);
        mTextCancle = (TextView) findViewById(R.id.type_cancel);
        initWindow(1.0f, 0.5f, Gravity.BOTTOM);
        setAnimate(R.style.animatedialog);
    }

    @Override
    protected void onSetListener() {
        mTextAlipay.setOnClickListener(this);
        mTextWeixin.setOnClickListener(this);
        mTextCancle.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.type_alipay:
                if (listener != null) {
                    listener.onSelectedAli();
                }
                break;
            case R.id.type_weixin:
                if (listener != null) {
                    listener.onSelectedWeixin();
                }
                break;
            case R.id.type_cancel:
                break;
        }
        cancel();
    }

    @Override
    protected void afterOnCreate(Bundle savedInstanceState) {

    }

    private Listener listener;

    public void setListener(Listener listener) {
        this.listener = listener;
    }

    public static class Listener {
        public void onSelectedAli() {
        }

        public void onSelectedWeixin() {
        }
    }
}
